const path  = require('path')
const fs = require('fs')
const express = require('express')

const getImgFileApp = express()

// 获取图片的接口处理
getImgFileApp.get('/:imgName', (req, res) => {
  res.setHeader('Content-Type', 'image/*')
  fs.createReadStream(path.resolve(__dirname, `../../storage/images/${req.params['imgName']}`)).pipe(res)
})

module.exports = getImgFileApp

